package Practice.Practice_02.UserManagementSystem;

import java.util.Objects;
import java.util.Scanner;

public class Login {
    public static int login(Person[] person) {
        int index = -1;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入账号：");
        String username = sc.next();
        System.out.println("请输入密码：");
        String password = sc.next();
        for (int i = 0; i < person.length; i++) {
            if(Objects.equals(person[i].getName(),username) && Objects.equals(person[i].getPass(),password)){
                index = i;
                break;
            }
        }
        return index;
    }
}
